package com.westvalley.syn.cron;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.aop.Enhancer;
import com.jfinal.kit.LogKit;
import com.westvalley.syn.service.NcBillTypeService;
import com.westvalley.syn.service.NcClientService;
import com.westvalley.syn.service.NcCompanyService;
import com.westvalley.syn.service.NcDeptService;
import com.westvalley.syn.service.NcIncomeService;
import com.westvalley.syn.service.NcPsnDocService;
import com.westvalley.syn.service.SynService;

import weaver.interfaces.schedule.BaseCronJob;

/**
 * NC数据同步定时计划
 * @author mos
 *
 */
public class NcSynCron extends BaseCronJob{
	@Override
	public void execute() {
		List<SynService> list = new ArrayList<SynService>();
		for(int i=0;i<list.size();i++){
			SynService service = list.get(i);
			list.add(Enhancer.enhance(NcCompanyService.class));
			list.add(Enhancer.enhance(NcDeptService.class));
			list.add(Enhancer.enhance(NcPsnDocService.class));
			list.add(Enhancer.enhance(NcClientService.class));
			list.add(Enhancer.enhance(NcIncomeService.class));
			list.add(Enhancer.enhance(NcBillTypeService.class));
			try{
				if(i!=0 && service!=null)
					service.executeSynData();
			}catch (Exception e) {
				LogKit.error("NC同步异常！",e);
			}
		}
	}
}
